package frontend.model.admin;

import backend.model.admin.Employee;
import backend.model.admin.ForeignManager;
import backend.model.admin.Project;
import frontend.model.base.UIModel;

public class ProjectUIModel implements UIModel<Project> {

    private String name;
    private String description;
    private boolean isDirectPayment;
    private boolean isActive;
    private Employee pmRomania;
    private ForeignManager pmNorway;

    private Project project;

    public ProjectUIModel() {
        project = new Project();
        isActive = true;
        isDirectPayment = true;
    }

    public ProjectUIModel(Project project) {
        this.project = project;
        populateFieldsFromDBModel();
    }

    @Override
    public void populateFieldsFromDBModel() {
        name = project.getName();
        description = project.getDescription();
        isDirectPayment = project.getIsDirectPayment();
        isActive = project.getIsActive();
        pmRomania = project.getPmRomania();
        pmNorway = project.getPmNorway();
    }

    @Override
    public void populateDBModelFromFields() {
        project.setDescription(description);
        project.setName(name);
        project.setIsDirectPayment(isDirectPayment);
        project.setIsActive(isActive);
        project.setPmRomania(pmRomania);
        project.setPmNorway(pmNorway);
    }

    public String getName() {
        return name;
    }

    public String getDescription() {
        return description;
    }

    @Override
    public Project getDBModel() {
        return project;
    }

    public Employee getPmRomania() {
        return pmRomania;
    }

    public ForeignManager getPmNorway() {
        return pmNorway;
    }
}
